//
//  YHThreeViewController.m
//  LyhToolsTest
//
//  Created by LYH on 2018/10/26.
//  Copyright © 2018年 LYH.com. All rights reserved.
//

#import "YHThreeViewController.h"
#import "YHTestCell.h"
#import "PublishFriendContentVC.h"
#import "DemoVC9.h"
@interface YHThreeViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong) UITableView *tableview;
@property (nonatomic, strong) NSArray *titleArray;
@end


@implementation YHThreeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self tableview];
    [self initnva];
}
- (void)initnva
{
    WeakSelf;
    wself.ts_navgationBar = [TSNavigationBar navWithTitle:@"ThreeVC"];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.titleArray.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // 1.创建cell
    static NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    
    // 2.设置cell的数据
    cell.textLabel.text = self.titleArray[indexPath.row];
    
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.row) {
        case 0:
        {
            PublishFriendContentVC *vc = [[PublishFriendContentVC alloc] init];
            [self.navigationController pushViewController:vc animated:YES];
        } break;
        case 1:
        {
            DemoVC9 *vc = [[DemoVC9 alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }break;
        default:
            break;
    }
   
}

- (UITableView *)tableview
{
    if (!_tableview) {
        _tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, SafeAreaTopHeight, kScreenWidth, kScreenHeigth-SafeAreaTopHeight-SafeAreaTabBarHeight) style:UITableViewStylePlain];
        _tableview.delegate = self;
        _tableview.dataSource = self;
        _tableview.rowHeight = 50;
        _tableview.backgroundColor = [UIColor whiteColor];
        [self.view addSubview:_tableview];
    }
    return _tableview;
}
- (NSArray *)titleArray
{
    if (!_titleArray) {
        _titleArray = @[@"霸屏神器",@"朋友圈"];
    }
    return _titleArray;
}
@end
